//###############
//FILE : NameServerRequestThread.java
//WRITER : Daniel Lowengrub, daniel_i_l, 320687098
//EXERCISE : oop ex3 2011
//DESCRIPTION:
//See below
//###############

package oop.ex3.nameserver;

import java.io.IOException;
import java.util.ArrayList;
import oop.ex3.communication.Request;
import oop.ex3.communication.RequestThread;
import oop.ex3.protocol.messages.ErrorMsg;

/**
 * This request thread looks for requests directed at a NS.
 * @author daniel
 */
public class NameServerRequestThread extends RequestThread {
    private static ErrorMsg _errorMsg = new ErrorMsg();

    /**
     * Create a request thread with a list of requests it should look for.
     * @param requests
     */
    public NameServerRequestThread(ArrayList<Request> requests) {
        super(requests);
    }


    @Override
    public RequestThread getCopy() {
        return new NameServerRequestThread(_requestList);
    }

    @Override
    protected void sendErrorMessage() {
        try {
            _errorMsg.send(_outputStream);
        } catch (IOException ex) {
            //if we cant send an error then just stop
        }
    }
}
